package cn.fl.system.transform;

import java.util.ArrayList;
import java.util.List;

import cmm.user.facade.system.dto.SysUsrDatAuthRDTO;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.system.vo.SysUsrDatAuthRVO;

 /**
 * @Description: 系统用户数据权限关系表 转换器
 * VO是客户端传递数据到服务端进行转换的数据 
 * VO转换数据变成DTO传递到服务端 
 * VO不能在服务端出现
 */
public class SysUsrDatAuthRVOTransform {


	/**
	 * DTO 转  VO
	 * @param po SysUsrDatAuthRDTO
	 * @return SysUsrDatAuthRVO
	 */
	public static SysUsrDatAuthRVO toVO(SysUsrDatAuthRDTO dto) {
		SysUsrDatAuthRVO  vo = null;
		if (dto != null) { 
			vo = new SysUsrDatAuthRVO();
			vo.setId(dto.getId());
			vo.setUsrId(dto.getUsrId());//用户ID
			vo.setOrgId(dto.getOrgId());//组织架构ID
			vo.setIsChg(dto.getIsChg());//是否主管
			vo.setIsSysDef(dto.getIsSysDef());
			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto SysUsrDatAuthRVO
	 * @return SysUsrDatAuthRDTO
	 */
	public static SysUsrDatAuthRDTO toDTO(SysUsrDatAuthRVO vo) {
		SysUsrDatAuthRDTO dto = null;
		if (vo != null) {
			dto = new SysUsrDatAuthRDTO();
			dto.setId(vo.getId());
			dto.setUsrId(vo.getUsrId());//用户ID
			dto.setOrgId(vo.getOrgId());//组织架构ID
			dto.setIsChg(vo.getIsChg());//是否主管
			dto.setIsSysDef(vo.getIsSysDef());
			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param list List<SysUsrDatAuthR>
	 * @return List<SysUsrDatAuthRDTO>
	 */
	public static List<SysUsrDatAuthRVO> toVOList(List<SysUsrDatAuthRDTO> list) {
		List<SysUsrDatAuthRVO>  voList = new ArrayList<SysUsrDatAuthRVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (SysUsrDatAuthRDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	/**
	 * VO集合 转 DTO集合
	 * @param list List<SysUsrDatAuthRVO>
	 * @return List<SysUsrDatAuthRDTO>
	 */
	public static List<SysUsrDatAuthRDTO> toDTOList(List<SysUsrDatAuthRVO> list) {
		List<SysUsrDatAuthRDTO>  dtoList = new ArrayList<SysUsrDatAuthRDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (SysUsrDatAuthRVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
